#include"Heap.h"

HeapSort(int* a, int n)
{
	for (int i = 1; i < n; i++)
	{
		AdjustUp(a, i);
	}

	int end = n - 1;
	while (end>0)
	{
		swap(&a[0], &a[end]);
		AdjustDown(a, end, 0);
		end--;
	}
}

void test1()
{
	int a[] = { 5,3,7,8,9,2 };
	HeapSort(a, sizeof(a) / sizeof(int));
	for (int i = 0; sizeof(a) / sizeof(int); i++)
	{
		printf("%d", a[i]);
	}
}
int main()
{
	test1();
	return 0;
}